<template>
  <div style="height:100%;width:100%;position:relative;" ref="maindev">
      <div class="pagetop" ref="buttondiv" :style="pagetopstyle">
          <div style="width: 100%">
              <table>
                  <col style="width: 4%;" />
                  <col style="width: 4%;" />
                  <col style="width: 1%;" />
                  <col style="width: 4%;" />
                  <col style="width: 3%;" />

                  <col style="width: 4%;" />
                  <col style="width: 10%;" />

                  <col style="width: 6%;" />
                  <col style="width: 11%;" />
                  <col style="width: 2%;" />
                  <col style="width: 11%;" />

                  <col style="width: 37%;" />
                  <tr>
                      <td align="right">报告日期</td>
                      <td colspan="4">
                          <el-date-picker v-model="searchParam.startdt" type="date" placeholder="开始日期" value-format="yyyy-MM-dd" :clearable="false" style="min-width: 120px;width:47%"></el-date-picker> 至
                          <el-date-picker v-model="searchParam.enddt" type="date" placeholder="结束日期" value-format="yyyy-MM-dd" :clearable="false" style="min-width: 120px;width:47%"></el-date-picker>
                      </td>
                      <td>报告单元</td>
                      <td>
                          <rm-ddl-rptunit prgno="LIS610" v-model="searchParam.rptunitid" width="100%" defaultflag="1" clearable @change="rptunitChange"></rm-ddl-rptunit>
                      </td>
                      <td>查询模板</td>
                      <td colspan="2">
                          <el-select style="width:100%" v-model="querymod" placeholder="" @change="querymodChange($event)" clearable filterable>
                              <el-option v-for="(item,index) in querymodOption" :key="index" :value="item.value" :label="item.label"></el-option>
                          </el-select>
                      </td>
                      <td style="text-align:left">
                          <el-button @click.native="btnSavequerymod" style="background-color:#e6e6e6;width:50px;color:black">保存</el-button>
                          <el-button @click.native="btnDelquerymod" style="background-color:#e6e6e6;width:50px;color:black">删除</el-button>
                      </td>
                  </tr>
                  <tr>
                      <td>性别
                      </td>
                      <td colspan="2">
                          <p style="float:left;width:calc(100% - 35px)">
                              <el-select v-model="searchParam.pat_sex" placeholder="请选择" style="width:100%">
                                  <el-option key="0" label="全部" value="0"></el-option>
                                  <el-option key="1" label="男" value="1"></el-option>
                                  <el-option key="2" label="女" value="2"></el-option>
                              </el-select>
                          </p>
                          <p style="float:right;height:100%;inline-height: initial; line-height: 25px;">病区</p>
                      </td>
                      <td colspan="2">
                          <rm-ddl-common :appendtobody="true" datatype="ward" dataname="病区" v-model="searchParam.req_wardno" width="100%" @change="reqwardChange"></rm-ddl-common>
                      </td>
                      <td style="color: #fd5645;font-weight: 600;text-align:right">报告项目</td>
                      <td>
                          <rm-ddl-rptitem prgno="LIS610" :germmode="false" v-model="searchParam.rpt_itemcode" width="180px" :appendtobody="true" :rptunitid="searchParam.rptunitid" @change="rptitemChange"></rm-ddl-rptitem>
                      </td>
                      <td style="text-align: right;">病人类型</td>
                      <td>
                          <rm-ddl-common ref="txtpattype" datatype="seccode" kindno="PT" dataname="" v-model="searchParam.pat_typecode" width="100%" :readonly="true" :clearable="true" @change="pattypeChange"></rm-ddl-common>
                      </td>
                      <td>样本类型</td>
                      <td>
                          <rm-ddl-common ref="ddlspecimen" datatype="specimen" dataname="样本类型" v-model="searchParam.specimen_code" width="100%" @change="specimenChange"></rm-ddl-common>
                      </td>
                      <td>&nbsp;</td>
                  </tr>
                  <tr>
                      <td align="right">年龄</td>
                      <td colspan="4">
                          <el-input size="small" style="width:118px" v-model="searchParam.agemin" oninput="value=value.replace(/[^\-?\d.]/g,'')" @focus="Focus($event)"></el-input>——
                          <el-input size="small" style="width:118px" v-model="searchParam.agemax" oninput="value=value.replace(/[^\-?\d.]/g,'')" @focus="Focus($event)"></el-input>
                      </td>
                      <td>仪器</td>
                      <td>
                          <rm-ddl-instrument width="100%" v-model="searchParam.instrid" prgno="LIS663" :clearable="true" @change="instrChange"></rm-ddl-instrument>
                      </td>
                      <td>申请科室</td>
                      <td>
                          <rm-ddl-common datatype="dept" dataname="科室" v-model="searchParam.req_deptno" width="100%" @change="reqdeptChange"></rm-ddl-common>
                      </td>
                      <td>申请医生</td>
                      <td>
                          <rm-ddl-common datatype="doctor" dataname="申请医生" v-model="searchParam.req_docno" width="100%" @change="reqdocChange"></rm-ddl-common>
                      </td>
                  </tr>
              </table>
              <div style="width:100%;text-align:right;padding-right:5px;padding-bottom:3px">
                  <el-button icon="el-icon-search" type="primary" @click="btnQuery" v-has="'PINQUERY'">查询</el-button>
                  <el-button @click.native="BtnClear" class="el-icon-refresh-left">清除</el-button>
                  <el-button icon="el-icon-download" @click="statExport" v-has="'PEXPORT'">导出统计数据</el-button>
                  <el-button icon="el-icon-close" type="warning" @click="btnExc">退出</el-button>
              </div>
          </div>
      </div>
      <div class="pagecenter" :style="pagecenter">
          <!-- <div class="middle-center" ref="xTableDiv"> -->
          <rm-layout-left splitcolor="#ffffff" :splitwidth="2" :fixsize="520" :minfixsize="520" :maxfixsize="520" ref="layoutright" :canDrag="false">
              <template v-slot:fix>
                  <vxe-table ref="xTable" :data="tableData" :loading="loading" :keyboard-config="keyConfig" :keyboard-local-config="keyLocalConfig" :select-config="selectConfig" :sort-config="{trigger: 'cell'}" :edit-config="{trigger: 'click', mode: 'cell'}" border fit height="100%" header-align="center" resizable show-header-overflow="tooltip" show-overflow="tooltip" size="mini" stripe :cell-class-name="cellClassName" @current-change="currentChangeEvent" highlight-current-row show-footer>
                      <vxe-table-column field="itemcode_en" sortable title="英文缩写" width="70" show-overflow></vxe-table-column>
                      <vxe-table-column align="center" field="sampledate" sortable title="样本日期" width="100" :formatter="['toDateString', 'yyyy-MM-dd']" show-overflow></vxe-table-column>
                      <vxe-table-column field="sampleno" title="样本号" width="70" header-align="center">
                      </vxe-table-column>
                      <vxe-table-column field="rpt_itemname" sortable title="检验项目" width="110" show-overflow></vxe-table-column>
                      <vxe-table-column field="result_str" sortable title="检验结果" width="80" show-overflow> <template v-slot="{ row }">
                              <div :style="{
                          background: row.cp_resultbackgroundcolor,
                          color: row.cp_resultcolor
                        }" style="padding:0px 10px">
                                  {{ row.result_str }}
                              </div>
                          </template></vxe-table-column>
                      <vxe-table-column field="sd" sortable title="SD" width="50" show-overflow header-align="center" align="right"></vxe-table-column>
                      <vxe-table-column field="rptunitname" title="报告单元" width="120" header-align="center" class="rowspantop"></vxe-table-column>
                      <vxe-table-column field="pat_name" sortable title="姓名" width="80" show-overflow></vxe-table-column>
                      <vxe-table-column field="pat_no" sortable title="病人号" width="100" show-overflow></vxe-table-column>
                      <vxe-table-column field="pat_sexname" sortable title="性别" width="50" show-overflow align=center></vxe-table-column>
                      <vxe-table-column field="pat_agestr" align="center" sortable title="年龄" width="40" show-overflow></vxe-table-column>
                      <vxe-table-column field="req_dept" sortable title="申请科室" width="150" show-overflow></vxe-table-column>
                      <vxe-table-column field="req_ward" sortable title="病人病区" width="120" show-overflow></vxe-table-column>
                      <vxe-table-column field="result_flag" align="center" sortable title="结果标志" width="60" show-overflow></vxe-table-column>
                      <vxe-table-column field="specimen_name" align="center" sortable title="样本类型" width="100" show-overflow></vxe-table-column>
                      <!-- <vxe-table-column field="orig_result_num" align="center" sortable title="原始数值结果" width="120" show-overflow></vxe-table-column> -->
                      <vxe-table-column field="req_bedno" align="center" sortable title="床号" width="70" show-overflow></vxe-table-column>
                      <vxe-table-column field="pat_typename" sortable title="病人类型" width="80" show-overflow></vxe-table-column>
                      <vxe-table-column field="create_dt" sortable title="创建时间" width="140" show-overflow></vxe-table-column>
                      <vxe-table-column field="barcode" sortable title="条码号" width="100" show-overflow></vxe-table-column>
                      <vxe-table-column field="req_doc" align="center" sortable title="申请医生" width="70" show-overflow></vxe-table-column>
                      <vxe-table-column field="pat_diag" sortable title="临床诊断" width="250" show-overflow></vxe-table-column>
                      <vxe-table-column field="report_user" align="center" sortable title="检验医生" width="70" show-overflow></vxe-table-column>
                      <vxe-table-column field="orig_result_num" sortable title="原始数值结果" width="150" show-overflow></vxe-table-column>
                      <vxe-table-column field="test_info" sortable title="上机信息" width="120" show-overflow></vxe-table-column>
                      <vxe-table-column field="rechk_dt" align="center" sortable title="审核时间" width="120" show-overflow></vxe-table-column>
                      <vxe-table-column field="rechk_user" align="center" sortable title="审核医生" width="60" show-overflow></vxe-table-column>
                      <vxe-table-column field="pat_idcardno" align="center" sortable title="身份证/护照号" width="200" show-overflow></vxe-table-column>
                      <vxe-table-column field="result_txt" sortable title="大文本结果" width="130" show-overflow></vxe-table-column>
                      <vxe-table-column field="report_comm" sortable title="报告单备注" width="150" show-overflow></vxe-table-column>
                      <vxe-table-column field="pat_id" sortable title="病人ID" width="100" show-overflow></vxe-table-column>
                      <vxe-table-column field="reportid" sortable title="报告ID" width="160" show-overflow></vxe-table-column>
                  </vxe-table>
              </template>
              <div style="width:100%;">
                  <!-- @change="WestFlagChange"  v-model="bWestσFlag" -->
                  <div class="tab-title">正态分布
                      <!-- <el-checkbox true-label="1" false-label="0" change="">显示均值</el-checkbox> -->
                      <!-- <el-tag style="margin:1.0 5px;height:23px;font-size:14px;line-height:23px;float:right">根据落点位置，选择质控规则。</el-tag> -->
                  </div>
              </div>
              <div style="width:100%;height:calc( 100% - 20px );border:1px solid #ccc">
                  <div id="LIS663Chart1" style="width: 100%; height: 100%; "></div>
              </div>
          </rm-layout-left>
          <!-- </div> -->
      </div>
      <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="请选择备注" :visible.sync="reportcommDlg">
          <rm-pop-common ref="popcom" @change="reportcommchange" @cancel="reportcommDlg=false;" kindno="reportcomm" datatype="seccode"></rm-pop-common>
      </el-dialog>
      <el-dialog width="1300px" height="450px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title=" 学术统计 使用说明" :visible.sync="bHelpDlg">
          <div style="width:1250px;height:700px">
              <el-image style="width:100%;" :src="src"></el-image>
          </div>
      </el-dialog>
  </div>
</template>

<script>
import XE from "xe-utils"; //引入工具类
import echarts from "echarts"; //引入echarts
export default {
  name: "LIS663",
  data() {
      return {
          xData: ["", "-3.5", "-2.5", "-1.5", "-0.5", "0.5", "1.5", "2.5", "3.5", "SD"],
          barData: [0, 0, 0, 0, 0, 0, 0, 0, 0],
          src: require("@/assets/img/LIS/LIS6/LIS661.jpg"),
          pattypeOption: [],
          keyConfig: {
              isDel: true,
              isTab: true,
              isEdit: true,
          },
          keyLocalConfig: {
              isArrow: true,
          },
          selectConfig: {
              tigger: "row",
          },
          del1sd: 0,
          del2sd: 0,
          del3sd: 0,
          bCalcDlg: false,
          calcParam: {
              numarr: [],
              item: "",
              cnt: "",
              avg: "",
              sd: "",
              cv: "",
              min: "",
              max: "",
              mid: "",
              p0001: "",
              p0100: "",
              p0250: "",
              p0500: "",
              p1000: "",
              p2000: "",
              p2500: "",
              p7500: "",
              p8000: "",
              p9000: "",
              p9500: "",
              p9750: "",
              p9900: "",
              p9990: "",
          },
          querymod: "",
          searchParam: {
              //1
              startdt: XE.toDateString(new Date(), "yyyy-MM-dd"),
              enddt: XE.toDateString(new Date(), "yyyy-MM-dd"),
              rptunitid: "1",
              autoref: "1",
              //2
              pat_sex: "0",
              req_wardno: "",
              rpt_itemcode: "",
              pat_typecode: "",
              specimen_code: "",
              //3
              agemin: "",
              agemax: "",
              instrid: "",
              req_deptno: "",
              req_docno: "",
          },
          numsdarr: [],
          macaddress: "",
          tableData: [],
          loading: false,
          selrow: {},
          selectall: false, 
          pagetopstyle: {
              position: "absolute",
              height: "130px",
              width: "100%",
          },
          pagecenter: {
              position: "absolute",
              top: "135px",
              bottom: "0px",
              overflow: "auto",
              width: "100%",
              left: "0px",
          },
          reportcommDlg: false, 
          reportheight: "auto",
          bHelpDlg: false,
          tabModel: "data",
          pointData: [],
          //!new
          querymodOption: [], //查询模版列表
          drawdt: 0,
          series: [],
          rptunitname: "",
          reqwardname: "",
          rpt_itemname: "",
          pattypename: "",
          specimenname: "",
          instrname: "",
          reqdeptname: "",
          reqdocname: "",
      };
  },
  mounted() {
      //抓缓存
      this.querymodOption = [];
      let modOption1 = localStorage.getItem("rm_Qmod_LIS663");
      let modOptions1 = JSON.parse(modOption1);
      if (modOptions1 != null) {
          this.querymodOption = XE.clone(modOptions1, true);
      }
      var echartsid = document.getElementById("LIS663Chart1");
      //画初始图
      this.charts = echarts.init(echartsid, "shine");
      this.$nextTick(() => {
          this.charts.resize({ width: this.autoWidth, height: this.autoHeight }); //窗口初始化时echart大小可自适应 ;
          this.Draw(); //初始化时画一个样子出来
      });
  },
  methods: {
      rptunitChange(code, name) {
          this.searchParam.rptunitid = code;
          this.rptunitname = name;
      },
      reqwardChange(code, name) {
          this.searchParam.req_wardno = code;
          this.reqwardname = name;
      },
      rptitemChange(code, name) {
          this.searchParam.rpt_itemcode = code;
          this.rpt_itemname = name;
      },
      pattypeChange(code, name) {
          this.searchParam.pat_typecode = code;
          this.pattypename = name;
      },
      specimenChange(code, name) {
          this.searchParam.specimen_code = code;
          this.specimenname = name;
      },
      instrChange(code, name) {
          this.searchParam.instrid = code;
          this.instrname = name;
      },
      reqdeptChange(code, name) {
          this.searchParam.req_deptno = code;
          this.reqdeptname = name;
      },
      reqdocChange(code, name) {
          this.searchParam.req_docno = code;
          this.reqdocname = name;
      },
      //导出正态分布
      statExport() {
          let extableColumn = [];
          let tableColumn = this.$refs.xTable.getColumns();
          tableColumn.forEach((item) => {
              extableColumn.push({ title: item.title, field: item.property });
          });
          let filtertxt = this.getExportFilter();
          this.$pub.exportTableExcel(this.tableData, extableColumn, "LIS623正态分布.xlsx", filtertxt, "统计条件：");
      },
      // 获取当前导出文件的所有查询条件
      getExportFilter() {
          let filtertxt = "报告日期:" + XE.toDateString(this.searchParam.startdt, "yyyy-MM-dd") + "至" + XE.toDateString(this.searchParam.enddt, "yyyy-MM-dd") + "; ";
          if(this.searchParam.rptunitid) filtertxt += "报告单元:" + this.rptunitname+ "; ";
          if(this.querymod) filtertxt += "查询模板:" + this.getOptionName(this.querymodOption.filter((item) =>  this.querymod==item.value))+ "; ";
          if (this.searchParam.pat_sex) filtertxt += "性别:" + (this.searchParam.pat_sex == "1" ? "男" : this.searchParam.pat_sex == "2" ? "女" : "全部") + "; ";
          if(this.searchParam.req_wardno) filtertxt += "病区:" + this.reqwardname+ "; ";
          if(this.searchParam.rpt_itemcode) filtertxt += "报告项目:" + this.rpt_itemname + "; ";
          if(this.searchParam.pat_typecode) filtertxt += "病人类型:" + this.pattypename+ "; ";
          if(this.searchParam.specimen_code) filtertxt += "样本类型:" + this.specimenname+ "; ";
          if(this.searchParam.agemin || this.searchParam.agemax)  "年龄:" + this.searchParam.agemin + "至" + this.searchParam.agemax+ "; ";
          if(this.searchParam.instrid) filtertxt += "仪器:" + this.instrname + "; ";
          if(this.searchParam.req_deptno)  filtertxt += "申请科室:" + this.reqdeptname + "; ";
          if(this.searchParam.req_docno) filtertxt += "申请医生:" + this.reqdocname+ "; ";
          return filtertxt;
      },
      getOptionName(option) {
          if (option && option.length > 0) {
              let optionname = "";
              option.forEach((item) => {
                  if(item.hasOwnProperty("display")) {
                      optionname += item.display + ",";
                  } else {
                      optionname += item.label + ",";
                  }
              });
              return optionname.substring(0, optionname.length - 1);
          } else {
              return "";
          }
      },
      //查询条件清空
      BtnClear() {
          this.charts.clear();
          this.tableData = []; //cls查询主表
          this.querymod = ""; //cls查询模板
          this.rptunitname = "";
          this.reqwardname = "";
          this.rpt_itemname = "";
          this.pattypename = "";
          this.specimenname = "";
          this.instrname = "";
          this.reqdeptname = "";
          this.reqdocname = "";
          this.searchParam = {
              //cls查询条件
              //1
              startdt: XE.toDateString(new Date(), "yyyy-MM-dd"),
              enddt: XE.toDateString(new Date(), "yyyy-MM-dd"),
              rptunitid: "1",
              //2
              pat_sex: "0",
              req_wardno: "",
              rpt_itemcode: "",
              pat_typecode: "",
              specimen_code: "",
              //3
              agemin: "",
              agemax: "",
              instrid: "",
              req_deptno: "",
              req_docno: "",
          };
      },
      //修改查询条件清空表格数据
      ClsData() {
          this.tableData = [];
          this.charts.clear();
          // this.$refs.rawXTable.loadData(this.rawData);
      },
      //todo 查询模版选择 这个需要再改
      querymodChange(value) {
          let modList = localStorage.getItem("rm_Qmod_LIS663");
          let tempOption = JSON.parse(modList);
          this.querymodOption = tempOption;
          let obj = localStorage.getItem("rm_Qmod_LIS663_" + value);
          let jsondate = JSON.parse(obj);
          this.rptunitname = jsondate.rptunitname;
          this.reqwardname = jsondate.reqwardname;
          this.rpt_itemname = jsondate.rpt_itemname;
          this.pattypename = jsondate.pattypename;
          this.specimenname = jsondate.specimenname;
          this.instrname = jsondate.instrname;
          this.reqdeptname = jsondate.reqdeptname;
          this.reqdocname = jsondate.reqdocname;
          this.searchParam = {
              startdt: jsondate.startdt,
              enddt: jsondate.enddt,
              rptunitid: jsondate.rptunitid,
              //2
              pat_sex: jsondate.pat_sex,
              req_wardno: jsondate.req_wardno,
              rpt_itemcode: jsondate.rpt_itemcode,
              pat_typecode: jsondate.pat_typecode,
              specimen_code: jsondate.specimen_code,
              //3
              agemin: jsondate.agemin,
              agemax: jsondate.agemax,
              instrid: jsondate.instrid,
              req_deptno: jsondate.req_deptno,
              req_docno: jsondate.req_docno,
          };
      },
      //查询模版保存
      btnSavequerymod() {
          let jsondate = this.searchParam;
          jsondate.rptunitname = this.rptunitname;
          jsondate.reqwardname = this.reqwardname;
          jsondate.rpt_itemname = this.rpt_itemname;
          jsondate.pattypename = this.pattypename;
          jsondate.specimenname = this.specimenname;
          jsondate.instrname = this.instrname;
          jsondate.reqdeptname = this.reqdeptname;
          jsondate.reqdocname = this.reqdocname;
          this.$prompt("查询模版保存名称", "文字编辑", {
              confirmButtonText: "确定",
              cancelButtonText: "取消",
          })
              .then(({ value }) => {
                  if (value && value.trim() != "") {
                      this.querymodOption = [];
                      let modOption = localStorage.getItem("rm_Qmod_LIS663");
                      let modOptions = JSON.parse(modOption);
                      let item = undefined;
                      if (modOptions != null) {
                          this.querymodOption = XE.clone(modOptions, true);
                          item = modOptions.find((m) => m.value == value);
                      }
                      if (item != undefined) {
                      } else {
                          this.querymodOption.push({
                              label: value,
                              value: value,
                          });
                      }
                      let modListJson = JSON.stringify(jsondate);
                      let modList = JSON.stringify(this.querymodOption);
                      localStorage.setItem("rm_Qmod_LIS663_" + value, modListJson);
                      localStorage.setItem("rm_Qmod_LIS663", modList);
                      this.querymod = value;
                  }
              })
              .catch(() => {
                  this.$message({
                      type: "info",
                      message: "取消输入",
                  });
              });
      },
      //查询模版删除
      btnDelquerymod() {
          this.$confirm("您确定删除查询模版：" + this.querymod + "吗？", {
              confirmButtonText: "确定",
              cancelButtonText: "取消",
              type: "warning",
          })
              .then(() => {
                  let value = this.querymod;
                  localStorage.removeItem("rm_Qmod_LIS663_" + value);
                  let modList = localStorage.getItem("rm_Qmod_LIS663");
                  let jsondate = JSON.parse(modList);
                  this.querymodOption = [];
                  jsondate.forEach((item) => {
                      if (item.value == value) {
                      } else {
                          this.querymodOption.push(item);
                      }
                  });
                  let newmodList = JSON.stringify(this.querymodOption);
                  localStorage.setItem("rm_Qmod_LIS663", newmodList);
                  this.querymod = "";
              })
              .catch(() => {});
      },
      Draw() {
          this.charts.clear();
          this.charts.setOption({
              title: {
                  text: this.drawTitleText,
                  left: "left",
                  textStyle: { fontWeight: "700", fontSize: "13" },
              },
              grid: [
                  {
                      // left: "10%",
                      bottom: "10%",
                      top: "20%",
                      // right: "10%",
                  },
              ],
              tooltip: {
                  show: true,
                  trigger: "axis",
                  confine: true,
                  axisPointer: {
                      type: "none",
                  },
              },
              xAxis: [
                  {
                      data: this.barData,
                      show: false,
                  },
                  {
                      data: this.xData,
                      axisLabel: {
                          interval: 0,
                          show: true,
                      },
                      position: "bottom",
                      boundaryGap: false,
                      axisPointer: {
                          show: false,
                      },
                  },
              ],
              yAxis: {
                  type: "value",
                  show: true,
                  splitLine: {
                      show: true, //隐藏或显示
                      //网格线
                      lineStyle: {
                          width: 0.5, // 粗细
                          color: "grey",
                          type: "solid", //设置网格线类型 dotted ：虚线   solid:实线  dashed
                      },
                  },
              },
              axisLabel: {
                  textStyle: {
                      color: "#fff",
                  },
              },
              series: [
                  {
                      data: this.barData,
                      type: "bar",
                      itemStyle: {
                          borderColor: "rgba(58, 58, 58, 1)",
                          color: "rgba(77, 163, 255, 1)",
                          borderWidth: 0.5,
                          //?若返回多种颜色可启用
                          // normal: {
                          // 这里是重点
                          //     color: function (params) {
                          // 注意，如果颜色太少的话，后面颜色不会自动循环，最好多定义几个颜色
                          //         var colorList = ["red","red","red","red","red","red"];
                          //         return colorList[0];
                          //     },
                          // },
                      },
                      backgroundStyle: {
                          color: "rgb(255,0,0)",
                      },
                      top: "bottom",
                      barMinWidth: "100%",
                      barCategoryGap: "0",
                      silent: true,
                      label: {
                          show: true,
                          position: "top",
                      },
                  },
              ],
          });
      },
      btnHelp() {
          this.bHelpDlg = true;
      },
      Focus(event) {
          event.currentTarget.select();
      },
      reportcommchange(c, v) {
          this.searchParam.report_comm = v;
          this.reportcommDlg = false;
      },
      //查询
      btnQuery() {
          if (this.searchParam.rpt_itemcode == "") {
              this.$alert("请您先选择报告项目。", "提示");
              return false;
          }
          this.loading = true;
          this.$tool
              .request({
                  url: "LIS/LIS6/LIS663",
                  method: "post",
                  data: {
                      action: "query",
                      ...this.searchParam,
                      macaddress: this.macaddress,
                  },
              })
              .then((res) => {
                  if (res.flag == "1") {
                      this.loading = false;
                      this.tableData = res.dt;
                      for (var i = 0; i < 10; i++) {
                          this.xData[i] = res.xArea[i];
                      }
                      for (var i = 0; i < 9; i++) {
                          this.barData[i] = res.bardt[0]["col" + (i + 1)];
                      }
                  } else if (res.flag == "0") {
                      this.loading = false;
                      this.tableData = [];
                      this.barData = [0, 0, 0, 0, 0, 0, 0, 0, 0];
                      this.xData = ["", "-3.5", "-2.5", "-1.5", "-0.5", "0.5", "1.5", "2.5", "3.5", "SD"];
                  }
                  this.loading = false;
                  this.Draw();
              })
              .catch((e) => {
                  this.loading = false;
              });
      },
      btnExc() {
          let index = this.$parent.$refs.itemtags.tagsList.findIndex((m) => m.name == "LIS663");
          this.$parent.$refs.itemtags.tagsList.splice(index, 1);
          this.$router.go(-1);
      },
      currentChangeEvent({ row }) {
          this.selrow = row;
      },
      cellClassName({ column, row }) {
          if (column.property == "emer_flag") {
              if (row.emer_flag == "1") {
                  return "col-red";
              } else {
                  return "";
              }
          }
      },
  },
};
</script>

<style scoped>
::v-deep.vxe-input--wrapper .vxe-input {
  height: auto;
  width: 200px;
  border-radius: 0px;
}
::v-deep.el-button--default.btn-custom-cancel {
  float: right !important;
  margin-left: 10px;
}

.pagetop {
  left: 0;
  right: 0;
  height: 215px;
  display: -webkit-box;
  -webkit-box-pack: center;
  -webkit-box-align: center;
  border: solid 1px #ccc;
  position: absolute;
  z-index: 99;
  overflow-x: auto;
  white-space: nowrap;
}

.chargeflag {
  padding: 0px 10px;
}

.pagecenter {
  position: absolute;
  top: 135px;
  width: 100%;
  left: 0;
  bottom: 0px;
  overflow: auto;
}

.middle-center {
  position: absolute;
  height: 100%;
  right: 0;
  left: 0;
  height: 100%;
}

table tr td:nth-child(odd) {
  text-align: right;
  white-space: nowrap;
}
table tr td:nth-child(even) {
  text-align: left;
}
table {
  font-size: 12px;
  border-collapse: separate;
  border-spacing: 5px;
}
::v-deep.el-checkbox__inner::after {
  border: 2px solid #000000 !important;
  box-sizing: content-box;
  content: "";
  border-left: 0 !important;
  border-top: 0 !important;
  height: 7px;
  left: 4px;
  position: absolute;
  top: 1px;
  transform: rotate(45deg) scaleY(0);
  width: 3px;
  transition: transform 0.15s ease-in 0.05s;
  transform-origin: center;
}
::v-deep.el-checkbox__input.is-disabled + span.el-checkbox__label {
  color: #000000;
  cursor: not-allowed;
}
::v-deep .el-checkbox__input.is-disabled .el-checkbox__inner,
.el-checkbox__input.is-disabled.is-checked .el-checkbox__inner + .el-input.is-disabled .el-input__inner {
  background-color: #ffffff !important;
}
::v-deep.el-date-editor.el-input,
.el-date-editor.el-input__inner {
  width: 130px;
}
::v-deep .chargeflag .el-radio {
  margin-right: 10px !important;
}
::v-deep .chargeflag .el-radio__label {
  width: 35px;
  display: inline-block;
}
::v-deep .middle-center .vxe-table {
  height: 100%;
}
::v-deep .middle-center .vxe-table--body-wrapper {
  /* height: calc(100% - 54px) !important; */
  height: 100%;
}
::v-deep .el-textarea__inner {
  background-color: #a3c1f429;
  padding: 3px 5px;
}
::v-deep .el-divider__text.is-left {
  padding-left: 3px;
  font-weight: bold;
  font-size: 16px;
  left: 0;
  color: #000;
  transform: translateY(-50%);
}
::v-deep .el-input__inner[ismh="1"] {
  /* background-color: #a3c1f429; */
}
::v-deep .ismh1 .el-input__inner {
  background-color: #a3c1f429;
}
/* new */
::v-deep .el-input--suffix .el-input__inner {
  padding-right: 5px;
}
::v-deep .el-tabs--border-card > .el-tabs__content {
  padding: 1px !important;
}
::v-deep .vxe-table .vxe-body--x-space {
  width: 100%;
  height: 1px;
  margin-bottom: 0 px;
}
.tab-title {
  margin: 0;
  font-size: 14px;
  height: 20px;
  /* margin: 0 1px 0 3px; */
  padding: 0 1px 0 3px;
  font-weight: 600;
  width: 100%;
  text-align: left;
  white-space: nowrap;
}
</style>